<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>新增人员</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="jquery/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.8.19.custom.min.js"></script>
<script src="script/commons.js" type="text/javascript"></script>
<script type="text/javascript">
	function check() {
		with (document.all) {
			if (customer.value == "") {
				alert("客户名称不允许为空");
				return false;
			} else {
				document.fincustomerForm.submit();
			}
		}
	}
	
	function setCustomerTitle() {
		$(".customerTitle").text(
			$("#parentCustomer").val() != 0 ? "店铺" : "渠道"
		);
	}
	
	$(document).ready(function(e) {
        setCustomerTitle();
    });
</script>
</head>
<body>
	<html:form method="post" action="customeradd.do">
		<div class="button_bar">
			<c:if
				test="${finuser.role.roleId == 1 or finuser.role.roleId == 3 or finuser.role.roleId == 4}">
				<button class="common_button" onclick="check();">
					保存</button>
			</c:if>
			<button class="common_button" onclick="back();">返回</button>
		</div>
		<table class="query_form_table detail_form_table">
			<tr>
				<th colspan="2"><span class="red_star">*</span>&nbsp;为必填项</th>
			</tr>
            <tr>
				<th><span class="customerTitle">渠道</span>代码&nbsp;<span class="red_star">*</span></th>
				<td>
					<html:text property="customerId" styleId="customerId" style="width: 250px;" maxlength="50"/>
				</td>
			</tr>
			<tr>
				<th>上级渠道&nbsp;&nbsp;&nbsp;</th>
				<td>
					<html:select property="parentCustomer" styleId="parentCustomer" onchange="setCustomerTitle()">
						<html:options collection="parentCustomers" property="customerid" labelProperty="customer"/>
					</html:select>
					（如果客户为渠道，此处选择总部）
				</td>
			</tr>
			<tr>
				<th><span class="customerTitle">渠道</span>名称&nbsp;<span class="red_star">*</span></th>
				<td>
					<html:text property="customer" styleId="customer" style="width: 250px;" maxlength="50"/>
					<html:errors property="customer" />
				</td>
			</tr>
			<tr>
				<th>备注&nbsp;<span class="red_star">*</span></th>
				<td>
					<html:text property="customerRemark" styleId="customerRemark" style="width: 250px;" maxlength="50"/>
					<html:errors property="customerRemark" />
				</td>
			</tr>
		</table>
	</html:form>
</body>
</html>